<template>
  <div class="root"> 

    <router-link class="box" v-for="v in nums" :to="'/Top/Tow/'+ v.id">
      <!--<router-link href='./page/Tow.vue'>-->
      <div>
        <div v-if="v.is_new" class="new">
          <span>新店</span>
        </div>
        <img :src="v.image_path|isf">
      </div>

        <!-- 右边信息 -->
        <div class="rightbox">
  
          <!-- 店家 -->
          <div class="one">
            <h2 :class='{"h2-name":v.is_premium}'>{{v.name}}</h2>
            <div class="one-span">
              <span v-for="n in v.supports" class='one-s'>{{n.icon_name}}</span>
            </div>
          </div>
  
          <!-- 星级评定一栏 -->
          <div class="two">
            <!--<h4>星级评定</h4>-->
            <div class="twobox">
              <div>
                <!--<span>星级评定</span>-->
                <Rater v-model="v.rating" 
                active-color='#FFAA0C' :font-size='starSize'
                 disabled></Rater>
                <!-- disabled: 是否被禁用 -->
              </div>
  
              <div class="two-2">
                <span style="color:#FF690F">{{v.rating}}</span>
                <span>月售{{v.recent_order_num}}单</span>
              </div>
            </div>
  
            <div class="zhunshi">
              <span v-if="v.delivery_mode">准时达</span>
              <span class="zhuansong" v-if="v.delivery_mode">蜂鸟转送</span>
            </div>
          </div>
  
          <!-- 配送费一栏 -->
          <div class="three">
            <!--<span class="fa fa-rmb"></span>-->
            <div>
              <span>￥{{v.float_minimum_order_amount}}元起送 / </span>
              <span>配送费约￥{{v.float_delivery_fee|pei}}</span>
            </div>
  
            <div class="three-box">
              <span>{{v.distance|dis}}km /</span>
              <span class="three-box-span"> {{v.order_lead_time}}分钟</span>
            </div>
  
          </div>
        </div>
      <!--</router-link>-->
    </router-link>
  </div>
</template>

<script>
// 星级评定的导入
import {Rater} from 'vux'

export default {
  props: ['nums'],
  components:{
    Rater
  },
  data(){
    return{
      rat:3.7,  // 声明一个变量,赋任意值
      starSize:13   // 设置星星的尺寸
    }
  },
}
</script>

<style scoped>
.box {
  margin: 10px 0px;
  border-bottom: 1px solid #F3F3F3;
  box-sizing: border-box;
  padding:3px;
    display: flex;
  text-decoration: none;
  position: relative;
}

.new {
  position: absolute;
  left: 0;
  top: 0;
  height: 3rem;
  width: 3rem;
  background: linear-gradient(135deg, #26ce61, #26ce61 50%, transparent 0);
}

.new span {
  color: white;
  font-weight: bold;
  display: block;
  transform: rotate(-45deg);
  font-size: 0.8rem;
}

img {
  width: 82px;
  height: 82px;
  padding: 3px 8px;
}

.rightbox {
  width: calc(100% - 90px);
  box-sizing: border-box;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
}

.one {
  display: flex;
  flex-basis: 35%;
  justify-content: space-between;
  align-items: flex-end;
}

.one h2 {
  color: black;
  font-size: 16px;
  margin: 0px;
  flex-basis: 76%;
  /*设置文本多余的显示成三个点 */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.h2-name:before {
  content: "品牌";
  font-weight: bold;
  background-color: #FFD930;
  font-size: 1rem;
  /*padding: 2px;*/
  border-radius: 2px;
  margin: 0 4px;
}

.one .one-s {
  border: 1px solid #D3D3D3;
  color: #8B8B8B;
  font-size: 10px;
  margin-right: 5px;
  padding: 1px;
}

.two {
  color: #808080;
  display: flex;
  margin-top: 2px;
  flex-basis: 35%;
  justify-content: space-between;
  align-items: flex-end;
}

.twobox {
  display: flex;
}

.two-2 {
  font-size: 12px;
}

.zhunshi {
  font-size: 10px;
}

.zhunshi span {
  border: 1px solid #2395FF;
  padding: 1px;
  border-radius: 3px;
  color: #2395FF;
}

.zhunshi .zhuansong {
  background-color: #2395FF;
  color: white;
  margin-right: 5px;
}



/* three */

.three {
  color: #808080;
  display: flex;
  justify-content: space-between;
  flex-basis: 30%;
  align-items: flex-end;
}

.three-box-span {
  /*flex-basis: 10%;*/
  color: #2F9BFF;
  margin-right: 5px;
}
</style>
